<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class User extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->id();
            $table->string('username',32)->unique()->nullable();
            $table->string('nickname',32)->nullable();
            $table->string('phone',11)->unique()->nullable();
            $table->string('email',128)->unique()->nullable();
            $table->string('password',128);
            $table->string('api_token',128)->unique()->nullable();
            $table->integer('api_token_expire')->unsigned()->default(0);
            $table->string('avatar',255)->nullable();
            $table->tinyInteger('status')->default(1);
            $table->integer('lastlogin')->unsigned()->default(0);
            //$table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
